//
//  Person.m
//  Object-C Category
//
//  Created by quentin on 15/9/17.
//  Copyright (c) 2015年 QuentinLabs. All rights reserved.
//

#import "Person.h"

@implementation Person

@synthesize name = _name;
@synthesize age =  _age;

-(void) test
{
    NSLog(@"这是一个Person 类的 Test 方法");
}

-(void) typing
{
    NSLog(@"这是一个Person 类的 typing 方法");
}

@end

#pragma mark -Creation

@implementation Person(Creation)

-(id)initWithName:(NSString*)aName
{
    self = [super init];
    if(self){
        self.name = aName;
    }
    return self;
}

-(id)initWithName:(NSString*)aName withAge:(int)age
{
    self = [super init];
    if(self){
        self.name = aName;
        self.age = age;
    }
    return self;
}

+(id)PersonWithName:(NSString *)aName
{
    Person* person = [[Person alloc]init];
    person.name = aName;
    
    return person;
}

+(id)PersonWithName:(NSString *)aName withAge:(int)age
{
    Person* person = [[Person alloc]init];
    person.name = aName;
    person.age = age;
    return person;
}

@end

@implementation Person(Life)

-(void)eat
{
    NSLog(@"Person Life-- I Was Eating");
}

-(void)sleep
{
    NSLog(@"Person Life -- I Was Sleeping");
}
-(void)play
{
    NSLog(@"Person Life -- I Was Playing");
}

@end